from django.conf.urls import patterns, include, url

from django.contrib import admin
from api.resources import TemaResource, VotoResource
from tastypie.api import Api
from ucpb.views import index
import api.views
from jsonrpc import jsonrpc_site

v1_api = Api(api_name='api')
v1_api.register(TemaResource())
v1_api.register(VotoResource())

admin.autodiscover()
urlpatterns = patterns('',
    # Examples:
     url(r'^temas/$', 'ucpb.views.stream_response', name='stream_response'),
     url(r'^votos/$', 'ucpb.views.stream_votos', name='stream_votos'),
     url(r'^resultados_csv/$', 'ucpb.views.resultados', name='resultados'),
     url(r'^$', 'ucpb.views.resultados_f', name='resultados_f'),
     url(r'^tema/(?P<identifier>\d+)/$', 'ucpb.views.tema',name='tema'),
     url(r'^post_voto/$', 'ucpb.views.post_voto',name='post_voto'),
     url(r'^stats_equipo/$','ucpb.views.stats',name='stats'),
     url(r'^json/browse/', 'jsonrpc.views.browse', name="jsonrpc_browser"), # for the graphical browser/web console only, omissible
     url(r'^json/', jsonrpc_site.dispatch, name="jsonrpc_mountpoint"),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
    url(r'^',include(v1_api.urls))
)
